package com.crm.system.service.impl;

import java.util.List;
import com.crm.common.utils.DateUtils;
import com.crm.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.crm.system.mapper.BiePatientMapper;
import com.crm.system.domain.BiePatient;
import com.crm.system.service.IBiePatientService;
import com.crm.common.core.text.Convert;

/**
 * 患者Service业务层处理
 * 
 * @author crm
 * @date 2021-05-10
 */
@Service
public class BiePatientServiceImpl implements IBiePatientService 
{
    @Autowired
    private BiePatientMapper biePatientMapper;

    /**
     * 查询患者
     * 
     * @param patientId 患者ID
     * @return 患者
     */
    @Override
    public BiePatient selectBiePatientById(String patientId)
    {
        return biePatientMapper.selectBiePatientById(patientId);
    }

    /**
     * 查询患者列表
     * 
     * @param biePatient 患者
     * @return 患者
     */
    @Override
    public List<BiePatient> selectBiePatientList(BiePatient biePatient)
    {
        return biePatientMapper.selectBiePatientList(biePatient);
    }

    /**
     * 新增患者
     * 
     * @param biePatient 患者
     * @return 结果
     */
    @Override
    public int insertBiePatient(BiePatient biePatient)
    {
        biePatient.setPatientId(UUID.randomUUID().toString());
        biePatient.setCreateTime(DateUtils.getNowDate());
        return biePatientMapper.insertBiePatient(biePatient);
    }

    /**
     * 修改患者
     * 
     * @param biePatient 患者
     * @return 结果
     */
    @Override
    public int updateBiePatient(BiePatient biePatient)
    {
        return biePatientMapper.updateBiePatient(biePatient);
    }

    /**
     * 删除患者对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBiePatientByIds(String ids)
    {
        return biePatientMapper.deleteBiePatientByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除患者信息
     * 
     * @param patientId 患者ID
     * @return 结果
     */
    @Override
    public int deleteBiePatientById(String patientId)
    {
        return biePatientMapper.deleteBiePatientById(patientId);
    }
}
